/**
 * 
 */
package com.paypal.melearning;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;

import com.paypal.melearning.service.UserService;
import com.paypal.melearning.ui.HeaderPannel;
import com.paypal.melearning.ui.component.BoardComponent;
import com.paypal.melearning.util.TestService;
import com.vaadin.Application;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalSplitPanel;
import com.vaadin.ui.Window;

/**
 * @author prakrishnan
 * 
 */
@Configurable
public class MeLearning extends Application {

	private Panel curWindow;
	/**
	 * 
	 */
	private static final long serialVersionUID = 6172379356918620770L;

	@Autowired
	private UserService usrService = new UserService();

	@Autowired
	private TestService service;

	private Window mainWindow;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.vaadin.Application#init()
	 */
	@Override
	public void init() {
		setTheme("runo");
		mainWindow = new Window("MeLearning");
		mainWindow.getContent().setSizeFull();

		VerticalSplitPanel pannel = new VerticalSplitPanel();
		pannel.setSplitPosition(10);

		Panel windowPanel = new Panel();
		windowPanel.setSizeFull();
		windowPanel.setScrollable(true);
		windowPanel.addComponent(new BoardComponent(usrService.getDefaultBoard()));

		Panel headerPanel = new Panel();
		headerPanel.setSizeFull();
		headerPanel.setScrollable(false);
		headerPanel.addComponent(new HeaderPannel(windowPanel));

		pannel.addComponent(headerPanel);
		pannel.addComponent(windowPanel);
		
		mainWindow.addComponent(pannel);

		setMainWindow(mainWindow);
	}

}
